﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:vm="clr-namespace:Lithnet.Transforms.Presentation"
                    xmlns:t="clr-namespace:Lithnet.Transforms;assembly=Lithnet.Transforms"
                    xmlns:core="clr-namespace:Lithnet.Common.Presentation;assembly=Lithnet.Common.Presentation">

    <DataTemplate  DataType="{x:Type vm:XPathQueryTransformViewModel}">
        <StackPanel>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                                
                <Label Content="XPath expression"
                       Grid.Row="1"
                       Grid.Column="0" />
                <TextBox Text="{Binding XPathQuery, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}"
                         Grid.Row="1"
                         Grid.Column="1" />

                <Label Content="When no match is found"
                       Grid.Row="2"
                       Grid.Column="0" />
                <ComboBox ItemsSource="{Binding Source={core:EnumExtension {x:Type t:OnMissingMatch}}}"
                          SelectedValue="{Binding OnMissingMatch, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}" 
                          SelectedValuePath="Value"
                          Grid.Row="2"
                          Grid.Column="1" />

                <Label Content="Default value"
                       Grid.Row="3"
                       Grid.Column="0" />
                <TextBox Text="{Binding DefaultValue, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}"
                         Grid.Row="3"
                         Grid.Column="1"
                         IsEnabled="{Binding DefaultValueIsEnabled}" />

                <Label Content="Return data type"
                       Grid.Row="4"
                       Grid.Column="0" />
                <ComboBox ItemsSource="{Binding Path=AllowedReturnTypes}"
                          SelectedValue="{Binding Path=UserDefinedReturnType, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}"
                          SelectedValuePath="Value"
                          Grid.Row="4"
                          Grid.Column="1" />
            </Grid>
        </StackPanel>
    </DataTemplate>

</ResourceDictionary>